//
//  DYJQuestionContentTableViewCell.m
//  Piece
//
//  Created by dllo on 16/6/8.
//  Copyright © 2016年 Northeast Dianli University. All rights reserved.
//

#import "DYJQuestionContentTableViewCell.h"

@implementation DYJQuestionContentTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.contentLabel.font = [UIFont systemFontOfSize:15];
    self.contentLabel.numberOfLines = 0;
}
- (void)setModel:(DYJQuestionContentModel *)model
{
    if (_model != model) {
        _model = model;
        self.contentLabel.text = model.answer_content;
        NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithData:[model.answer_content dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
        NSRange range = NSMakeRange(0, attributedString.length);
        [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15] range:range];
        self.contentLabel.attributedText = attributedString;
//        NSString *contentStr = [attributedString string];
//        NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:15], NSFontAttributeName, nil];
//        CGRect rect = [contentStr boundingRectWithSize:CGSizeMake(ScreenWidth - 20, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
//        self.contentLabel.frame = CGRectMake(10, 10, rect.size.width, rect.size.height);
        
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
